package seeders

import (
	"github.com/goravel/framework/facades"
	"goravel/app/models/systemEntity"
)

type RoleSeeder struct {
}

// Signature The name and signature of the seeder.
func (s *RoleSeeder) Signature() string {
	return "RoleSeeder"
}

// Run executes the seeder logic.
func (s *RoleSeeder) Run() error {

	role1 := systemEntity.Role{
		Name:   "管理员",
		Value:  "admin",
		Remark: "全站控制",
		Status: 1,
	}

	err := facades.Orm().Query().Create(&role1)
	if err != nil {
		return nil
	}
	role2 := systemEntity.Role{
		Name:   "编辑员",
		Value:  "editor",
		Remark: "内容控制",
		Status: 1,
	}
	err = facades.Orm().Query().Create(&role2)
	if err != nil {
		return err
	}

	role3 := systemEntity.Role{
		Name:   "财务",
		Value:  "financial",
		Remark: "资金管理",
		Status: 1,
	}
	err = facades.Orm().Query().Create(&role3)
	if err != nil {
		return err
	}

	return nil
}
